package me.xiaolei.andlog.impls

import me.xiaolei.andlog.ILog
import me.xiaolei.andlog.interceptor.IInterceptor
import me.xiaolei.andlog.interceptor.impls.DiskInterceptor
import me.xiaolei.andlog.interceptor.impls.LogInterceptor

object AndLog : ILog by LogImpl
{
    /**
     * 添加日志处理流程
     */
    fun addInterceptor(interceptor: IInterceptor)
    {
        LogImpl.addInterceptor(interceptor)
    }

    /**
     * 设置控制台是否输出配置
     */
    fun consoleLogConfig(enable: Boolean, config: (LogInterceptor.() -> Unit)? = null)
    {
        LogInterceptor.enable = enable
        if (config != null)
            LogInterceptor.config()
    }

    /**
     * 写入本地的日志配置
     */
    fun diskLogConfig(enable: Boolean, config: (DiskInterceptor.() -> Unit)? = null)
    {
        DiskInterceptor.enable = enable
        if (config != null)
            DiskInterceptor.config()
    }
}